package cn.gpnu.web.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/shopping_servlet2")
public class shopping_servlet2 extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        //设置编码
//        resp.setContentType("text/html;charset=utf-8");
//        //输出
//        resp.getWriter().write("登录失败，用户名或者密码错误");
        resp.getWriter().write("you are a piece of shit");
//        int id = Integer.parseInt(req.getParameter("id"));
//        req.setAttribute("id",id);
        req.getRequestDispatcher("/failServlet").forward(req,resp);
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req,resp);
    }
}
